home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 5725 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.3 KB  |  41 lines

  1. Path: news.mindlink.net!giant!a09748
  2. From: a09748@giant.mindlink.bc.ca (ESSA)
  3. Newsgroups: comp.os.ms-windows.programmer.tools.mfc,comp.lang.c++,comp.lang.basic.visual.misc
  4. Subject: Prob calling VC++ 4.0 DLL from VB4 (32bit)
  5. Date: 6 Feb 1996 16:05:37 GMT
  6. Organization: MIND LINK! - British Columbia, Canada
  7. Message-ID: <4f7u8h$63q@fountain.mindlink.net>
  8. NNTP-Posting-Host: giant.mindlink.net
  9. X-Newsreader: TIN [version 1.2 PL2]
  10.  
  11.  
  12. Having a frustrating time trying to call a function in a DLL developed in
  13. VC++ 4.0 from Visual Basic 4.0 (32bit). I'm getting VB error 49 (bad DLL
  14. calling convention) from the following simple function ...
  15.  
  16. In mydll.h
  17. #define DllExport __declspec(dllexport)
  18. extern "C" long DllExport TestLongParam(long lParam);
  19.  
  20. In mydll.cpp
  21. extern "C" long DllExport TestLongParam(long lParam)
  22. {
  23.     TRACE("TestLongParam called with %ld\n", lParam);
  24.     return(1L);
  25. }
  26.  
  27. The Declare in VB is
  28. Declare Function TestLongParam Lib "MYDLL.DLL" (ByVal lParam As Long) As Long
  29.  
  30. When I call TestLongParam from VB, I get the TRACE output with the correct 
  31. value for the passed parameter, but on return, VB gives error 49.
  32.  
  33. Can anyone sugesst what is wrong with the way I have declared the functions ?
  34. I have played around with the __stdcall modifier, the WINAPI macro and even
  35. tried the old obsolete FAR PASCAL with no success.
  36.  
  37. Thx
  38.  
  39. ---
  40. pwhiteside@essa.com
  41.